package com.muyu.payment.domain.model;

import java.math.BigDecimal;
import java.util.Date;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.model.QueryModel;
import com.muyu.payment.domain.req.PaymentOrderQueryReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 支付订单查询请求模型对象
 *
 * @author muyu
 * @date 2025-09-16
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PaymentOrderQueryModel extends QueryModel<PaymentOrderQueryModel>  {
    /**
     * 主键
     */
    private Long id;
    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 订单金额
     */
    private BigDecimal amount;

    /**
     * 订单状态(1:待支付,2:已支付,8:已关闭,9:已退款)
     */
    private Long orderStatus;

    /**
     * 支付时间
     */
    private Date payTime;

    /**
     * 支付渠道
     */
    private String payChannel;

    /**
     * 第三方交易号
     */
    private String payTradeNo;

    /**
     * 订单标题
     */
    private String subject;

    /**
     * 订单描述
     */
    private String body;

    /**
     * 客户端IP (IPv4/IPv6)
     */
    private String clientIp;

    /**
     * 异步通知地址
     */
    private String notifyUrl;

    /**
     * 同步返回地址
     */
    private String returnUrl;

    /**
     * 订单过期时间
     */
    private Date expireTime;
    /**
     * 备注
     */
    private String remark;

    /**
     * 支付类型
     */
    private Long payType;
    /**
     * 创建者
     */
    private String createBy;
    /**
     * 修改者
     */
    private String updateBy;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 修改时间
     */
    private Date updateTime;


    /**
     * 查询构造器
     */
    public static PaymentOrderQueryModel reqBuild( PaymentOrderQueryReq queryReq){
        PaymentOrderQueryModel paymentOrderQueryModel = PaymentOrderQueryModel.builder()
            .id(queryReq.getId())
            .orderNo(queryReq.getOrderNo())
            .userId(queryReq.getUserId())
            .amount(queryReq.getAmount())
            .orderStatus(queryReq.getOrderStatus())
            .payTime(queryReq.getPayTime())
            .payChannel(queryReq.getPayChannel())
            .payTradeNo(queryReq.getPayTradeNo())
            .subject(queryReq.getSubject())
            .body(queryReq.getBody())
            .clientIp(queryReq.getClientIp())
            .notifyUrl(queryReq.getNotifyUrl())
            .returnUrl(queryReq.getReturnUrl())
            .expireTime(queryReq.getExpireTime())
            .remark(queryReq.getRemark())
            .payType(queryReq.getPayType())
            .build();
        paymentOrderQueryModel.domainBuild(queryReq);
        return paymentOrderQueryModel;
    }
}
